package com.tianhao.shardingsphere.controller;

import com.tianhao.shardingsphere.domain.ExpendDetails;
import com.tianhao.shardingsphere.service.ExpendDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 支出明细
 *
 * @author lth
 * @created 2022年09月02日 星期五 9:37
 */
@RestController
@RequestMapping("/v1/{organizationId}/expend-details")
public class ExpendDetailsController {

    @Autowired
    private ExpendDetailsService expendDetailsService;


    @PostMapping()
    public void save(@PathVariable Long organizationId,@RequestBody ExpendDetails expendDetails){
        expendDetails.setTenantId(organizationId);
        expendDetailsService.save(expendDetails);
    }


    @GetMapping("/{id}")
    public ExpendDetails selectOne(@PathVariable Long organizationId,@PathVariable Long id){
        return expendDetailsService.getById(id);
    }
}
